<?php
if(!defined('IN_PHPSCUP'))exit('hacking'); 
class RollpicModel extends BaseModel
{

    var $table  = 'index_images';	

    var $_page_rows = 20;	
	
    /* 插入数据 */
    function post($data)
    {    
	
		$time = time();     
    
		return $this->IU_Sql_Exe(array ('data' => array('name'=>"$data[name]",'images_url'=>"$data[path]",'images_link'=>"$data[link]",'images_target'=>"$data[target]",'images_alt'=>"$data[alt]",'add_time'=>"$time",'status'=>"$data[show]",'lang_type'=>trim($GLOBALS['Lang']->_lang_tp)), 'mode' => 'INSERT'));

        
    }

    function show()
    {   
	
		 $info = $this->S_Sql_Exe(array('fields' =>'*','conditions' =>"lang_type='".trim($GLOBALS['Lang']->_lang_tp)."' "));
    
		 return $info;
        
    }

    /* 删除数据 */
    function del($id ='')
    {      
		return $this->D_Sql_Exe(array ('conditions' =>"id = '{$id}' "));
        
    }

    /* 修改数据 */
    function editaction($id ='',$data = '')
    {    
		$time = time();  	      
		return $this->IU_Sql_Exe(array ('data' => array('name'=>"$data[name]",'images_url'=>"$data[path]",'images_link'=>"$data[link]",'images_target'=>"$data[target]",'images_alt'=>"$data[alt]",'add_time'=>"$time",'status'=>"$data[show]",'lang_type'=>trim($GLOBALS['Lang']->_lang_tp)),'mode' => 'UPDATE','conditions' =>"id = '{$id}' "));
        
    }

    /* 修改数据 */
    function editsort($id ='',$data = '')
    {   
     
		return $this->IU_Sql_Exe(array ('data' => array('sort'=>"$data[sort]"),'mode' => 'UPDATE','conditions' =>"id = '{$id}' "));
        
    }



    /* 通过id取出一条数据 */
    function oneshow($id ='')
    {    
	      
		 $info = $this->S_Sql_Exe(array('fields' =>'*','conditions' =>"id='{$id}'",'return' =>'one'));
    
		 return $info;
        
    }


}






?>